package com.isoft.c2team3service2.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.isoft.c2team3service2.entity.PrivatePost;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface PrivatePostMapper extends BaseMapper<PrivatePost> {

    @Select("SELECT * FROM private_post WHERE user_id = #{userId} OR artist_id = #{artistId} ORDER BY create_time DESC")
    List<PrivatePost> selectPrivatePosts(Integer userId, Integer artistId);

    /**
     * 查询用户的角色ID
     */
    @Select("SELECT role_id FROM tb_person WHERE id = #{userId}")
    Integer selectUserRoleId(Integer userId);
}